package com.yonyou.cyxdms.sysAuth.service.service.dealerchannel;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yonyou.cyx.framework.service.base.ICommonService;
import com.yonyou.cyxdms.sysAuth.service.dto.dealerchannel.DealerDTO;
import com.yonyou.cyxdms.sysAuth.service.dto.dealerchannel.DealerDetailDTO;
import com.yonyou.cyxdms.sysAuth.service.dto.dealerchannel.DealerInfoDTO;
import com.yonyou.cyxdms.sysAuth.service.dto.dealerchannel.DealerListDTO;
import com.yonyou.cyxdms.sysAuth.service.entity.DealerInfoPO;
import com.yonyou.cyxdms.sysAuth.service.vo.companyorg.DealerOrgAreaVO;
import com.yonyou.cyxdms.sysAuth.service.vo.companyorg.DealerPageVO;
import com.yonyou.cyxdms.sysAuth.service.vo.dealerchannel.DealerOrgVO;
import com.yonyou.cyxdms.sysAuth.service.vo.dealerchannel.SaleInfoVO;
import com.yonyou.cyxdms.sysmanage.client.vo.dealer.DealerInfoAVO;
import com.yonyou.cyxdms.sysmanage.client.vo.dealer.DealerInfoParentVO;
import com.yonyou.cyxdms.sysmanage.client.vo.dealer.DealerOrAscOrCompanyVO;
import com.yonyou.cyxdms.sysmanage.client.vo.dealer.DealerPictureVO;
import com.yonyou.cyxdms.sysmanage.client.vo.org.OrgParentVO;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author zhangsx
 * @since 2018-10-22
 */
public interface DealerInfoService extends ICommonService<DealerInfoDTO, DealerInfoPO, Long> {
    /**
     * 新增来自dms的经销商信息
     *
     * @param dto
     * @return java.lang.Long
     * @author zhangsx
     * @since 2018/10/22
     */
    public Long insertDealerInfoFromDms(DealerInfoDTO dto);

    /**
     * 更新来自dms的经销商信息
     *
     * @param dto
     * @return void
     * @author zhangsx
     * @since 2018/10/31
     */
    public void updateDealerInfoFromDms(DealerInfoDTO dto);

    public void updateDealerInfoFromDmss(Long id, DealerInfoDTO dto);

    /**
     * 通过dealerCode获取dealerId
     *
     * @param dealerCode
     * @return java.lang.Long
     * @author zhangsx
     * @since 2018/11/12
     */
    public Long getDealerIdByDealerCode(String dealerCode);

    /**
     * 根据dealerId查询dealerCode
     *
     * @author dengqiang
     * @since 2019/1/4
     */
    public String getDealerCodeByDealerId(Long dealerId);

    /**
     * 根据dealerCode获取经销商信息
     *
     * @param dealerCode
     * @param appId
     * @return com.yonyou.cyx.dealer.service.entity.dto.dealerinfo.DealerInfoDTO
     * @author zhangsx
     * @since 2019/1/9
     */
    public DealerInfoDTO getDealerInfoByCode(String dealerCode, String appId);

    public List<DealerInfoDTO> dealerInfoList(DealerListDTO dealerListDTO);

    public DealerInfoDTO dealerDetailInfo(DealerDetailDTO detail);


    /**
     * //根据经销商ID查询在售品牌列表
     *
     * @author dengqiang
     * @since 2019/2/14
     */
    public List<Long> getSaleCarbrandIdList(Long dealer, String appId);

    /**
     * 根据经销商id获取经销商试驾地址
     *
     * @author dengqiang
     * @since 2019/2/14
     */
    public String getDriveAddress(Long dealerId);

    /**
     * 经销商名称(根据appId和dearCode可以确定唯一性)
     *
     * @author dengqiang
     * @since 2019/5/16
     */
    public String getDealerName(String appId, String dealerCode);

    String obtainDealer();

    List<DealerDTO> getDealer(Long currentPage, Long size);

    /**
     * 获取登录用户公司信息
     *
     * @auther: 李贺
     * @since: 2019/9/6
     */
    DealerOrAscOrCompanyVO getDealerOrAscOrCompany(String ownerCode);

    /**
     * 保存经销商信息
     *
     * @auther: 李贺
     * @since: 2019/9/10
     */
    void addDealerInfo(DealerInfoPO dealerinfopo);

    /**
     * 更新经销商信息
     *
     * @auther: 李贺
     * @since: 2019/9/16
     */
    void updateDealerById(DealerInfoPO dealerinfopo);

    /**
     * 查询经销商信息
     *
     * @auther: 李贺
     * @since: 2019/9/16
     */
    DealerInfoPO selectById(Integer dealerId);


    List<Map<String, String>> getDealerInfoByCodes(List<String> ownerCodes, Boolean isBlack, String appId,
                                                   String ownerCode, String orgId, Integer currentPage, Integer pageSize,
                                                   Long companyId);

    Map<String, String> getDealerHeightLevelCode(String ownerCode, String appId);


    IPage<DealerPageVO> getDealerByParam(Page<DealerPageVO> page, String dealerName);

    /**
     * 获取所有销售公司信息
     *
     * @auther: 李贺
     * @since: 2019/10/9
     */
    IPage<SaleInfoVO> getSaleInfo(Page<SaleInfoVO> page);

    /**
     * 新增修改销售公司
     *
     * @auther: 李贺
     * @since: 2019/10/9
     */
    void addSaleInfo(SaleInfoVO saleInfoVO);

    /**
     * 销售信息查询
     *
     * @author adu
     * @since 2019/10/10
     */
    public IPage<DealerInfoDTO> selectPageSaleInfo(Page<DealerInfoDTO> page, Map<String, Object> queryCondition);

    /**
     * 新增-销售信息维护
     *
     * @param dealerInfoDTO
     * @author adu
     * @since 2019/10/10
     */
    public Integer addSaleInfoMaintain(DealerInfoDTO dealerInfoDTO);

    /**
     * 根据orgid 或者name拿 ownerCode
     *
     * @param orgId
     * @param ownerName
     * @param:
     * @return:
     * @auther: tanjie
     * @since: 2019/10/24
     */
    List<DealerInfoDTO> getDealerByorgId(String orgId, String ownerName);

    /**
     * 车厂通过组织id（大区小区类型的组织）获取本车厂下对应的经销商
     *
     * @param orgId
     * @param:
     * @return: 车厂通过组织id（大区小区类型的组织）获取本车厂下对应的经销商
     * @auther: 马邢健
     * @since: 2019/10/31
     */
    List<DealerOrgAreaVO> getDealerBySaleArea(String orgId, String dealerCode, String dealerName);

    /**
     * 获取经销商公司的 经销商类型
     *
     * @param:
     * @return:
     * @auther: 李贺
     * @since: 2019/11/4
     */
    Integer getDealerType();

    /**
     * 是否有售后
     *
     * @param:
     * @return:
     * @auther: 李贺
     * @since: 2019/11/4
     */
    Integer afterSale();


    /**
     * 根据条件查询经销商code
     *
     * @auther: 李贺
     * @since: 2019/11/13
     */
    List<DealerInfoParentVO> getDealerInfos(Long orgId, Long provinceId);

    /**
     * 根据省市区查询经销商信息
     *
     * @auther: 李贺
     * @since: 2019/11/13
     */
    List<DealerInfoParentVO> getDealerByCity(Integer provinceId, Integer cityId, Integer countyId);

    List<DealerOrgAreaVO> getDealerBysaleAreaBatch(String orgId, String appId, List<String> dealerCodes, Long companyId, String dealerName);

    /**
     * 获得所有经销商信息
     *
     * @auther: 李贺
     */
    List<DealerInfoParentVO> getAllDealer(String orgId);

    DealerInfoAVO getDealerByOwner(String ownerCode);

    DealerInfoDTO querytDealerInfo(Long dealerId);

    /**
     * 获取所有经销商
     * 李贺
     */
    List<DealerOrgVO> dealerByCityOrArea(Integer provinceId, Integer cityId, String orgId);

    List<DealerDTO> getAllDealerCode(String appId);

    /**
     * 获得经销商所属区域
     * 李贺
     *
     * @param
     * @return
     */
    List<OrgParentVO> getSaleArea(List<Long> dealerIds);

    /**
     * 保存经销商营业时间和门店图片
     * <p>
     * 李贺
     */
    void setDealerPicture(DealerPictureVO dealerPictureVO);

    /**
     * 获取经销商营业时间和门店图片
     * <p>
     * 李贺
     */
    List<DealerPictureVO> getDealerPictures(String dealerIds, String dealerCodes);

    /**
     * 获取所有销售部门
     * <p>
     * 李贺
     */
    List<Long> listDealerOrgs();
    /**
     * 获取登录用户的公司信息通过name或者code
     * <p>
     * 李贺
     */
    DealerOrAscOrCompanyVO getCompanyByCodeOrName(String ownerCode);
}
